#ifndef AUDIOINPUT_H
#define AUDIOINPUT_H

#include <QObject>
#include <QAudioSource>
#include <QIODevice>

class AudioInput : public QObject
{
    Q_OBJECT
public:
    explicit AudioInput(QObject *parent = nullptr);
    ~AudioInput();

signals:
    void audioinputerror(QString);

private:
    QAudioSource *audio;
    QIODevice *inputdevice;
    char *recvbuf;

private slots:
    void handleStateChanged(QAudio::State);
    QString errorString();
    void onreadyRead();

public slots:
    void setVolumn(int);
public:
    void startCollect();
    void stopCollect();
};

#endif // AUDIOINPUT_H
